Change in openvpn[master]: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE c...
A message that is not in the archive (sent off-list or not yet received): gerrit.1737029493000.Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc@...2715...
Attention is currently required from: flichtenheld, plaisthos.
Hello plaisthos, flichtenheld,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to review the following change.
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
9 files changed, 729 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/1
CMakeLists.txt +1 -0
@@ -818,6 +818,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +5 -1
@@ -3981,7 +3981,7 @@ } } -static struct multi_instance * +struct multi_instance *lookup_by_cid (struct multi_context *m,const unsigned long cid) {if (m)
@@ -4129,6 +4129,10 @@ cb.client_auth = management_client_auth; cb.client_pending_auth = management_client_pending_auth; cb.get_peer_info = management_get_peer_info; + cb.push_update_broadcast = management_callback_send_push_update_broadcast; + cb.push_update_by_cid = management_callback_send_push_update_by_cid; + cb.push_update_by_cn = management_callback_send_push_update_by_cn; + cb.push_update_by_addr = management_callback_send_push_update_by_addr; management_set_callback(management, &cb); }#endif /* ifdef ENABLE_MANAGEMENT */
src/openvpn/multi.h +5 -0
@@ -714,5 +714,10 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -135,4 +145,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +246 -0
255 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -325,4 +325,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +245 -2
277 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 1
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#3).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
9 files changed, 730 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/3
CMakeLists.txt +1 -0
@@ -818,6 +818,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +5 -1
@@ -3981,7 +3981,7 @@ } } -static struct multi_instance * +struct multi_instance *lookup_by_cid (struct multi_context *m,const unsigned long cid) {if (m)
@@ -4129,6 +4129,10 @@ cb.client_auth = management_client_auth; cb.client_pending_auth = management_client_pending_auth; cb.get_peer_info = management_get_peer_info; + cb.push_update_broadcast = management_callback_send_push_update_broadcast; + cb.push_update_by_cid = management_callback_send_push_update_by_cid; + cb.push_update_by_cn = management_callback_send_push_update_by_cn; + cb.push_update_by_addr = management_callback_send_push_update_by_addr; management_set_callback(management, &cb); }#endif /* ifdef ENABLE_MANAGEMENT */
src/openvpn/multi.h +5 -0
@@ -714,5 +714,10 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -135,4 +145,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +247 -0
256 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -325,4 +325,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +245 -2
277 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 3
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, plaisthos.
Hello flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#4).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
9 files changed, 740 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/4
CMakeLists.txt +1 -0
@@ -818,6 +818,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +5 -1
@@ -3981,7 +3981,7 @@ } } -static struct multi_instance * +struct multi_instance *lookup_by_cid (struct multi_context *m,const unsigned long cid) {if (m)
@@ -4129,6 +4129,10 @@ cb.client_auth = management_client_auth; cb.client_pending_auth = management_client_pending_auth; cb.get_peer_info = management_get_peer_info; + cb.push_update_broadcast = management_callback_send_push_update_broadcast; + cb.push_update_by_cid = management_callback_send_push_update_by_cid; + cb.push_update_by_cn = management_callback_send_push_update_by_cn; + cb.push_update_by_addr = management_callback_send_push_update_by_addr; management_set_callback(management, &cb); }#endif /* ifdef ENABLE_MANAGEMENT */
src/openvpn/multi.h +5 -0
@@ -714,5 +714,10 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -135,4 +145,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +256 -0
265 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -325,4 +325,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +246 -2
278 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 4
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, mrbff, plaisthos.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 5: Code-Review-1
(1 comment)
Patchset:
PS5:
This needs a patch to doc/management-notes.txt and the super-long text blob in test_push_update_msg.c needs to be wrapped to multiple lines
``` "foo bar " "and so on " "the saga goes" ```
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 5
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Sun, 18 May 2025 22:18:22 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos.
Hello cron2, flichtenheld, plaisthos,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#6).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 796 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/6
CMakeLists.txt +1 -0
@@ -832,6 +832,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +5 -1
@@ -4062,7 +4062,7 @@ } } -static struct multi_instance * +struct multi_instance *lookup_by_cid (struct multi_context *m,const unsigned long cid) {if (m)
@@ -4210,6 +4210,10 @@ cb.client_auth = management_client_auth; cb.client_pending_auth = management_client_pending_auth; cb.get_peer_info = management_get_peer_info; + cb.push_update_broadcast = management_callback_send_push_update_broadcast; + cb.push_update_by_cid = management_callback_send_push_update_by_cid; + cb.push_update_by_cn = management_callback_send_push_update_by_cn; + cb.push_update_by_addr = management_callback_send_push_update_by_addr; management_set_callback(management, &cb); }#endif /* ifdef ENABLE_MANAGEMENT */
src/openvpn/multi.h +5 -0
@@ -710,5 +710,10 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +256 -0
265 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -331,4 +331,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +257 -2
289 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 6
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos.
stipa has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 7: Code-Review-1
(1 comment)
Patchset:
PS7:
I did some testing and indeed I was able to send PUSH_UPDATE messages to the client. However it doesn't change the state on the server - for example, after pushing new client IP address we got broken tunnel because server rejects packets with unknown source address.
Are there plans to implement the second part too in 2.7 or later? At the moment this implementation is not that useful.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 7
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Thu, 03 Jul 2025 13:19:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#8).
The following approvals got outdated and were removed:
Code-Review-1 by stipa
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 824 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/8
CMakeLists.txt +1 -0
@@ -861,6 +861,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +5 -1
@@ -4072,7 +4072,7 @@ } } -static struct multi_instance * +struct multi_instance *lookup_by_cid (struct multi_context *m,const unsigned long cid) {if (m)
@@ -4220,6 +4220,10 @@ cb.client_auth = management_client_auth; cb.client_pending_auth = management_client_pending_auth; cb.get_peer_info = management_get_peer_info; + cb.push_update_broadcast = management_callback_send_push_update_broadcast; + cb.push_update_by_cid = management_callback_send_push_update_by_cid; + cb.push_update_by_cn = management_callback_send_push_update_by_cn; + cb.push_update_by_addr = management_callback_send_push_update_by_addr; management_set_callback(management, &cb); }#endif /* ifdef ENABLE_MANAGEMENT */
src/openvpn/multi.h +5 -0
@@ -710,5 +710,10 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +278 -0
287 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +263 -2
301 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 8
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#9).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 895 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/9
CMakeLists.txt +1 -0
@@ -861,6 +861,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +53 -1
69 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -710,5 +710,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6); + +#endif #endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +292 -0
301 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +269 -2
307 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 9
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#10).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 895 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/10
CMakeLists.txt +1 -0
@@ -861,6 +861,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +53 -1
69 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -710,5 +710,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +292 -0
301 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +269 -2
307 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 10
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, mrbff, plaisthos, stipa.
flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 10: Code-Review-1
(1 comment)
Patchset:
PS10:
Fails build with --disable-management
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 10
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Comment-Date: Thu, 10 Jul 2025 09:43:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#11).
The following approvals got outdated and were removed:
Code-Review-1 by flichtenheld
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 893 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/11
CMakeLists.txt +1 -0
@@ -861,6 +861,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +182 -1
213 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +49 -1
65 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -710,5 +710,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +292 -0
301 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 11
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 11:
(2 comments)
Patchset:
PS7:
Quoted 1 line
I did some testing and indeed I was able to send
PUSH_UPDATEmessages to the client. […]
Now it should work, although it might need a patch to improve it.
Patchset:
PS10:
Quoted 1 line
Fails build with --disable-management
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 11
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Fri, 11 Jul 2025 06:10:34 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Comment-In-Reply-To: stipa <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 16: Code-Review-1
(13 comments)
Patchset:
PS16:
lots of string and buffer related nagging, plus some general questioning if we need this in the full breadth...
File doc/management-notes.txt:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/a8274ef9_1e452d98 :
PS16, Line 1075:
I do question whether this is a reasonable approach, to have "by cn" and "by addr" functions, that add code (... that needs to be tested and maintained) when a management client can just look up the CID itself, and then do push-update-cid?
Is this something AS wants? Or "let's just do all variants, so nobody complains about a missing feature"?
File src/openvpn/manage.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/54080c2e_539d2c6e :
PS16, Line 1362: }
I bet there are more elegant and less repetitive ways to do 4 different if (status) print(SUCCESS!) else print(ERROR) blocks...
File src/openvpn/push.h:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/f1e00c73_49d8e6c7 :
PS16, Line 54:
This does confuse me a bit. If we have no ENABLE_MANAGEMENT, why would we have UPD_BY_ADDR or UPD_BY_CN? Is this usable from a plugin interface or a script?
File src/openvpn/push_util.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/fb47d1a4_53787e8b :
PS16, Line 66: /* Allocate memory and asseble the final message */ typo
http://gerrit.openvpn.net/c/openvpn/+/869/comment/384c531b_cb1d0b7b :
PS16, Line 82: }
it might increase readability to juse use snprintf( ... "%s,%s%s", push_update_cmd, src, continuation? continuation: 0) here... and get rid of i.
Or use buf_printf() and get rid of the length and malloc stuff... (returning BSTR(&buf) then).
http://gerrit.openvpn.net/c/openvpn/+/869/comment/e1cd130c_c8e39305 :
PS16, Line 122: msgs[im] = forge_msg(str, ",push-continuation 2", gc);
I do wonder if this can be done without modifying the string, so getting rid of the strdup() requirement...
http://gerrit.openvpn.net/c/openvpn/+/869/comment/5e9e0424_e91519f2 :
PS16, Line 143: /* It actually send the already divided messagge to one single client */ This comment needs a visit from the grammar police ;-)
``` /* send the message(s) prepared to one single client */ ```
http://gerrit.openvpn.net/c/openvpn/+/869/comment/648be3fc_6ea876c8 :
PS16, Line 158: buf_write(&buf, msgs[i], strlen(msgs[i]));
If you want to have the message in a buf here, you could have forge_msg() just use buf_printf() and return the resulting buf...?
http://gerrit.openvpn.net/c/openvpn/+/869/comment/caf4cb50_9100e63f :
PS16, Line 165: /* After sending the control message, we update the options server-side in the client's context */
Can you extend the comment a bit on why this is needed? I assume (which might or might not be a bad idea) that this is so ifconfig-push and ifconfig-ipv6-push can work? cipher etc. is not PUSH_UPDATE-able, and most other options the server should not care about? But without a bit of more specific explanation, this is very, uh, non-intuitive stuff.
http://gerrit.openvpn.net/c/openvpn/+/869/comment/693c5314_a1a08fa4 :
PS16, Line 204: if (!message_splitter(gc_strdup(msg, &gc), msgs, &gc, safe_cap))
Please do not call strdup() in a function call... yes, this works, but it is hard to read and no gain compared to "just call strdup() at the beginning of message_splutter() (if it turns out to be necessary).
http://gerrit.openvpn.net/c/openvpn/+/869/comment/8aa9f5e8_3e0aac7c :
PS16, Line 239:
how can we ever end here if ENABLE_MANAGEMENT is not defined? Except for the unit test, there is no caller remaining...
http://gerrit.openvpn.net/c/openvpn/+/869/comment/ecc7ac6a_56bfc11e :
PS16, Line 305: RETURN_UPDATE_STATUS(n_sent);
so here we have this nice if/else macro that manage.c could use :-)... but only 3 out of 4 functions use it? Can we not do the "does this CID exist?" check in the caller (for management_callback_send_push_update_by_cid())?
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 16
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 21 Jul 2025 19:53:36 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#18).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 861 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/18
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +157 -1
188 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +49 -1
65 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -702,5 +702,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +285 -0
294 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 18
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 17:
(12 comments)
File doc/management-notes.txt:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/33d4ba61_04cc0d55 :
PS16, Line 1075:
Quoted 1 line
I do question whether this is a reasonable approach, to have "by cn" and "by addr" functions, that a […]
i mostly followed the kill command, but yes it is the second one.
File src/openvpn/manage.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/183ce8a9_448ff5ac :
PS16, Line 1362: }
Quoted 1 line
I bet there are more elegant and less repetitive ways to do 4 different `if (status) print(SUCCESS!) […]
Done
File src/openvpn/push.h:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/940bc697_89ca7f9f :
PS16, Line 54:
Quoted 1 line
This does confuse me a bit. […]
you can get the cid only from management, but theoretically the rest could be used by other functions in the future
File src/openvpn/push_util.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/ccbe9b3d_34774f2d :
PS16, Line 66: /* Allocate memory and asseble the final message */
Quoted 1 line
typo
Done
http://gerrit.openvpn.net/c/openvpn/+/869/comment/a9514c2d_3d9f4c1f :
PS16, Line 82: }
Quoted 1 line
it might increase readability to juse use `snprintf( ... […]
Done
http://gerrit.openvpn.net/c/openvpn/+/869/comment/bc395641_798e9979 :
PS16, Line 122: msgs[im] = forge_msg(str, ",push-continuation 2", gc);
Quoted 1 line
I do wonder if this can be done without modifying the string, so getting rid of the
strdup()requi […]
Acknowledged
http://gerrit.openvpn.net/c/openvpn/+/869/comment/9e0a4d3f_be2fdaaa :
PS16, Line 143: /* It actually send the already divided messagge to one single client */
Quoted 1 line
This comment needs a visit from the grammar police ;-) […]
Done
http://gerrit.openvpn.net/c/openvpn/+/869/comment/c617f505_475db955 :
PS16, Line 158: buf_write(&buf, msgs[i], strlen(msgs[i]));
Quoted 1 line
If you want to have the message in a
bufhere, you could haveforge_msg()just use `buf_printf() […]
ok, working on it
http://gerrit.openvpn.net/c/openvpn/+/869/comment/ac640134_01fb9aae :
PS16, Line 165: /* After sending the control message, we update the options server-side in the client's context */
Quoted 1 line
Can you extend the comment a bit on why this is needed? I assume (which might or might not be a bad […]
Done
http://gerrit.openvpn.net/c/openvpn/+/869/comment/7a73548b_cfd887a6 :
PS16, Line 204: if (!message_splitter(gc_strdup(msg, &gc), msgs, &gc, safe_cap))
Quoted 1 line
Please do not call
strdup()in a function call... […]
Done
http://gerrit.openvpn.net/c/openvpn/+/869/comment/4e68ba97_68899c76 :
PS16, Line 239:
Quoted 1 line
how can we ever end here if
ENABLE_MANAGEMENTis not defined? Except for the unit test, there is no […]
We can't now, yes, but the function could be used somewhere else in the future
http://gerrit.openvpn.net/c/openvpn/+/869/comment/d6fc2d7c_558c5256 :
PS16, Line 305: RETURN_UPDATE_STATUS(n_sent);
Quoted 1 line
so here we have this nice if/else macro that
manage.ccould use :-)... […]
i need to do the lookup anyway in send_push_update(), so it would duplicate code with no good reason i think, but i can use the macro anyway, np
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 17
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 24 Jul 2025 08:21:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#19).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 859 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/19
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +157 -1
188 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +49 -1
65 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -702,5 +702,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +283 -0
292 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 19
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 18:
(1 comment)
File src/openvpn/push_util.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/7f156fa3_fdb8685b :
PS16, Line 158: buf_write(&buf, msgs[i], strlen(msgs[i]));
Quoted 1 line
ok, working on it
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 18
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 24 Jul 2025 12:19:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#20).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 857 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/20
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +45 -0
51 lines not on this page · raw message
src/openvpn/manage.c +157 -1
188 lines not on this page · raw message
src/openvpn/manage.h +4 -1
@@ -44,7 +44,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1<<16)#define MF_EXTERNAL_KEY_DIGEST (1<<17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -205,6 +204,10 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); +bool (*push_update_by_cn)(void *arg,const char *cn,const char *options); +bool (*push_update_by_addr)(void *arg,const struct mroute_addr *maddr,const char *options); };/*
src/openvpn/multi.c +49 -1
65 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -702,5 +702,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +39 -0
@@ -42,6 +42,16 @@#define PUSH_OPT_TO_REMOVE (1<<0)#define PUSH_OPT_OPTIONAL (1<<1) +/* Push-update message sender modes */ +typedef enum { +UPT_BROADCAST =0 , +UPT_BY_ADDR =1 , +UPT_BY_CN =2 , +#ifdef ENABLE_MANAGEMENT +UPT_BY_CID =3 +#endif +}push_update_type ; +int process_incoming_push_request (struct context *c);/**
@@ -134,4 +144,33 @@void receive_auth_pending (struct context *c,const struct buffer *buffer); +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +#ifdef ENABLE_MANAGEMENT + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +bool management_callback_send_push_update_by_cn (void *arg,const char *cn,const char *options); + +bool management_callback_send_push_update_by_addr (void *arg,const struct mroute_addr *maddr,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +281 -0
290 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 20
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 21: Code-Review-1
(3 comments)
Patchset:
PS21:
getting there
File doc/management-notes.txt:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/6ddb1ed1_95abe02b :
PS16, Line 1075:
Quoted 1 line
i mostly followed the
killcommand, but yes it is the second one.
So we discussed this at the community meeting today, and we should go for "do only what people really need" (= testing, maintenance) - so, push-update-cid and push-update-broad should stay, and cn and addr are left out.
File src/openvpn/push.h:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/8416a3dd_3e281a0d :
PS16, Line 54:
Quoted 1 line
you can get the cid only from management, but theoretically the rest could be used by other function […]
As we have no other communication channels in OpenVPN 2.x today that can asynchronously decide "we need new options at a client now!" (plugins or scripts are only called on connect, and not "while a client is connected") this first patch should be "management only". So please make the #ifdef ENABLE_MANAGEMENT thing wider, and include all of the new code and data structures.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 21
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Wed, 06 Aug 2025 14:09:07 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#22).
The following approvals got outdated and were removed:
Code-Review-1 by cron2
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast, via cid, via common name, via address) and send a PUSH_UPDATE control message to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 712 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/22
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -1
92 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1 << 16)#define MF_EXTERNAL_KEY_DIGEST (1 << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -199,6 +198,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -686,5 +686,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +33 -0
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -127,4 +136,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +258 -0
267 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 22
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 21:
(2 comments)
File doc/management-notes.txt:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/5a3c25e7_de4f1297 :
PS16, Line 1075:
Quoted 1 line
So we discussed this at the community meeting today, and we should go for "do only what people reall […]
Done
File src/openvpn/push.h:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/0c15dcee_8fcf4ab4 :
PS16, Line 54:
Quoted 1 line
As we have no other communication channels in OpenVPN 2. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 21
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Thu, 07 Aug 2025 17:26:41 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#23).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message
to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 712 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/23
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -1
92 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1 << 16)#define MF_EXTERNAL_KEY_DIGEST (1 << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -199,6 +198,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -686,5 +686,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +33 -0
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -127,4 +136,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +258 -0
267 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 23
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 23: Code-Review-2
(2 comments)
Patchset:
PS23:
There's two things that need fixing - one is a (trivial) rebase accident in manage.c (and please check if there are more of them).
The other is a lack of robustness on invalid pushed options on the server side - that is, you do on the management interface
``` push-update-broad blab SUCCESS: 1 client(s) updated SUCCESS: push-update command succeeded ```
(so it claims "success") but what really happens is "the full server restarts"
``` Aug 17 18:11:40 gentoo tun-udp-p2mp[4243]: MANAGEMENT: CMD 'push-update-cid 20 -dns' Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: MANAGEMENT: CMD 'push-update-broad blab' Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,blab' (status=1) Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: Pushed option is not updatable: 'blab'. Restarting. Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: Failed to process push update message sent to client ID: 0 Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Close Socket failed: Bad file descriptor (errno=9) Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: TCP/UDP: Closing socket Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: SIGUSR1[soft,Offending option received from server] received, process restarting Aug 17 18:11:46 gentoo tun-udp-p2mp[4243]: Restart pause, 1 second(s) ```
it should not do that, but give an error on the management interface instead.
If pushing "correct" stuff it works, even if the timing is a bit odd
server:
``` Aug 17 18:16:01 gentoo tun-udp-p2mp[4243]: MANAGEMENT: CMD 'push-update-broad "route 10.204.0.0 255.255.240.0"' ```
client
``` 2025-08-17 18:16:12 PUSH: Received control message: 'PUSH_UPDATE,route 10.204.0.0 255.255.240.0' ```
so it took 11 seconds for the message to actually get out (clocks are in sync, and this is observable, so not a "clocks are wrong" artefact).
There is something else that isn't right with pushing ifconfigs, but maybe I am doing it wrong
``` push-update-cid 2 "ifconfig 10.204.2.46 10.204.2.45" SUCCESS: 1 client(s) updated ```
client does new ifconfig. Ping server gives
``` Aug 17 18:20:08 gentoo tun-udp-p2mp[4243]: cron2-freebsd-tc-amd64/udp6:194.97.140.21:14092 MULTI: bad source address from client [10.204.2.46], packet dropped ```
so the client is using the correct source IP, but the server has not learned it.
The server claims it has, though
``` Aug 17 18:19:54 gentoo tun-udp-p2mp[4243]: MULTI: Learn: 10.204.2.46/0 -> cron2-freebsd-tc-amd64/udp6:194.97.140.21:14092 ```
The /0 is a bit suspicious, for "regular" learning it prints
``` Aug 17 18:17:32 gentoo tun-udp-p2mp[4243]: MULTI: Learn: 10.204.2.6 -> cron2-freebsd-tc-amd64/udp6:194.97.140.21:14092 ```
For IPv6 it does not work either
``` Aug 17 18:23:37 gentoo tun-udp-p2mp[4243]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,ifconfig-ipv6 fd00:abcd:204:2::9a9a/64 fd00:abcd:204:2::1' (status=1) Aug 17 18:23:37 gentoo tun-udp-p2mp[4243]: MULTI: Learn: ::/0 -> cron2-freebsd-tc-amd64/udp6:194.97.140.21:14092 Aug 17 18:23:46 gentoo tun-udp-p2mp[4243]: cron2-freebsd-tc-amd64/udp6:194.97.140.21:14092 MULTI: bad source address from client [fd00:abcd:204:2::9a9a], packet dropped ```
why ::/0 ?!?
File src/openvpn/manage.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/9d6db2f0_20959fe8 :
PS23, Line 136: msg(M_CLIENT, "version [n] : Set client's version to n or show current version of daemon.");
Unfortunately a rebase accident has happened here, and now this line is printed twice. While trivial to correct, project rules require that I do not do code-changes on merge.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 23
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sun, 17 Aug 2025 16:24:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 23:
(1 comment)
Patchset:
PS23:
Quoted 1 line
There's two things that need fixing - one is a (trivial) rebase accident in manage. […]
Well, "3 things that need fixing", that is :-)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 23
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Sun, 17 Aug 2025 16:25:28 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#24).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message
to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
10 files changed, 712 insertions(+), 8 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/24
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -3
94 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1 << 16)#define MF_EXTERNAL_KEY_DIGEST (1 << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -199,6 +198,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -686,5 +686,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/push.h +33 -0
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -127,4 +136,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +258 -0
267 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +271 -2
309 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 24
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 23:
(1 comment)
File src/openvpn/manage.c:
http://gerrit.openvpn.net/c/openvpn/+/869/comment/3f50d336_21e71356 :
PS23, Line 136: msg(M_CLIENT, "version [n] : Set client's version to n or show current version of daemon.");
Quoted 1 line
Unfortunately a rebase accident has happened here, and now this line is printed twice. […]
Done
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 23
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 18 Aug 2025 14:20:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
「小閃電,啟動自動賺 錢!」
隨時開戰、每筆真實到帳,醒來只管數
取得 Android 版 Outlook<https://aka.ms/AAb9ysg>
________________________________
From: mrbff (Code Review) <[email protected]...>
Sent: Monday, August 18, 2025 10:20:26 PM
Cc: openvpn-devel <[email protected]>; plaisthos <[email protected]...>
Subject: [Openvpn-devel] [L] Change in openvpn[master]: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE c...
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
View Change<http://gerrit.openvpn.net/c/openvpn/+/869?usp=email>
1 comment:
* File src/openvpn/manage.c:
* Patch Set #23, Line 136:<http://gerrit.openvpn.net/c/openvpn/+/869/comment/3f50d336_21e71356> msg(M_CLIENT, "version [n] : Set client's version to n or show current version of daemon.");
Unfortunately a rebase accident has happened here, and now this line is printed twice. […]
Done
To view, visit change 869<http://gerrit.openvpn.net/c/openvpn/+/869?usp=email>. To unsubscribe, or for help writing mail filters, visit settings<http://gerrit.openvpn.net/settings>.
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 23
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 18 Aug 2025 14:20:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 24:
(1 comment)
Patchset:
PS23:
Quoted 1 line
Well, "3 things that need fixing", that is :-)
About the first point, i fixed the restarting in the server but the "sending a wrong message and considering it a SUCCESS" was like this by design. The checks for valid options in the server are made just to update the ifconfig if necessary but they are not part of the 'core' logic of sending the message. Of course i could make this checks and just after validating the options deciding if sending the message or not but maybe it should be discussed i think
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 24
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Mon, 25 Aug 2025 10:42:39 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
Hello cron2, flichtenheld, plaisthos, stipa,
I'd like you to reexamine a change. Please visit
http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
to look at the new patch set (#25).
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message
to update some options.
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/options.c
M src/openvpn/options_util.c
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
13 files changed, 735 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/25
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -3
94 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1 << 16)#define MF_EXTERNAL_KEY_DIGEST (1 << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -199,6 +198,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -686,5 +686,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/options.c +0 -1
@@ -5488,7 +5488,6 @@ {continue ;/* Ignoring this option */ } -throw_signal_soft (SIGUSR1 ,"Offending option received from server" );return false;/* Cause push/pull error and stop push processing */ }
src/openvpn/options_util.c +2 -2
@@ -205,11 +205,11 @@ {if (*flags &PUSH_OPT_OPTIONAL ) { -msg (D_PUSH ,"Pushed option is not updatable: '%s'. Ignoring." , line); +msg (D_PUSH ,"Pushed dispensable option is not updatable: '%s'. Ignoring." , line); }else { -msg (M_WARN ,"Pushed option is not updatable: '%s'. Restarting." , line); +msg (M_WARN ,"Pushed option is not updatable: '%s'." , line);return false; } }
src/openvpn/push.c +5 -1
@@ -1073,6 +1073,10 @@break ; } } +else + { +throw_signal_soft (SIGUSR1 ,"Offending option received from server" ); + } }else if (ch =='\0' ) {
@@ -1100,7 +1104,7 @@ }else if (honor_received_options &&buf_string_compare_advance (&buf, push_update_cmd)) { -return process_incoming_push_update (c, permission_mask, option_types_found, &buf); +return process_incoming_push_update (c, permission_mask, option_types_found, &buf, false); }else {
src/openvpn/push.h +36 -1
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -56,6 +65,7 @@* @param option_types_found A pointer to a variable that will be filled with the types of options * found in the message. * @param buf A buffer containing the received message. +* @param msg_sender A boolean indicating if function is called by the message sender (server). * * @return * - `PUSH_MSG_UPDATE`: The message was processed successfully, and the updates were applied.
@@ -65,7 +75,8 @@*/ int process_incoming_push_update (struct context *c,unsigned int permission_mask, -unsigned int *option_types_found,struct buffer *buf); +unsigned int *option_types_found,struct buffer *buf, +bool msg_sender); int process_incoming_push_msg(struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask,
@@ -127,4 +138,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +264 -1
283 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +278 -4
333 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 25
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-MessageType: newpatchset
Attention is currently required from: cron2, flichtenheld, plaisthos, stipa.
mrbff has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 25:
(1 comment)
Patchset:
PS23:
Quoted 1 line
About the first point, i fixed the restarting in the server but the "sending a wrong message and con […]
* Regarding the second point, the odd timing it's because the message is just enqueued (by send_control_channel_string()) but it gets "on the wire" only when tls_process() is finally called, so you could get from less than 1 up to around 10 seconds of latency from when the command is injected through management to when the packet leave the server instance.
* Regarding 3rd point instead, yes, the /0 was an issue, i was misusing a function's parameter. For the push-update usage i think the only 'correct' way of pushing an ifconfig option should be something like ifconfig 10.204.2.47 255.255.255.0 (shouldn't we use it only in subnet mode?) with the pushed ip in the same subnet of the server virtual ip, in this case 10.204.2.45/24 for example (or do we want to update the server ip too?) . I mean, this look to me the only practical use case but maybe i'm missing something, if so please tell me.
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 25
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Tue, 26 Aug 2025 15:31:15 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: mrbff <[email protected]...>
Gerrit-MessageType: comment
Attention is currently required from: flichtenheld, mrbff, plaisthos, stipa.
cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
Patch Set 25: Code-Review+2
(1 comment)
Patchset:
PS25:
This still has a few rough edges, but for "go into 2.7_beta1" it is good enough - server does no longer crash, and learning of new IPs works.
Unlearning of old IPs is still marked TODO, and some of the messages on pushing garbage are a bit weird...
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 25
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: mrbff <[email protected]...>
Gerrit-Attention: stipa <[email protected]...>
Gerrit-Comment-Date: Wed, 03 Sep 2025 16:48:05 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment
PATCH v25 1/1 PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
In reply to a message not in the archiveFrom: Marco Baffo <[email protected]...>
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message
to update some options.
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/869
This mail reflects revision 25 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
CMakeLists.txt +1 -0
@@ -862,6 +862,7 @@ src/openvpn/push_util.c src/openvpn/options_util.c src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -3
94 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1 << 16)#define MF_EXTERNAL_KEY_DIGEST (1 << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -199,6 +198,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +8 -0
@@ -686,5 +686,13 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); + +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/options.c +0 -1
@@ -5488,7 +5488,6 @@ {continue ;/* Ignoring this option */ } -throw_signal_soft (SIGUSR1 ,"Offending option received from server" );return false;/* Cause push/pull error and stop push processing */ }
src/openvpn/options_util.c +2 -2
@@ -205,11 +205,11 @@ {if (*flags &PUSH_OPT_OPTIONAL ) { -msg (D_PUSH ,"Pushed option is not updatable: '%s'. Ignoring." , line); +msg (D_PUSH ,"Pushed dispensable option is not updatable: '%s'. Ignoring." , line); }else { -msg (M_WARN ,"Pushed option is not updatable: '%s'. Restarting." , line); +msg (M_WARN ,"Pushed option is not updatable: '%s'." , line);return false; } }
src/openvpn/push.c +5 -1
@@ -1073,6 +1073,10 @@break ; } } +else + { +throw_signal_soft (SIGUSR1 ,"Offending option received from server" ); + } }else if (ch =='\0' ) {
@@ -1100,7 +1104,7 @@ }else if (honor_received_options &&buf_string_compare_advance (&buf, push_update_cmd)) { -return process_incoming_push_update (c, permission_mask, option_types_found, &buf); +return process_incoming_push_update (c, permission_mask, option_types_found, &buf, false); }else {
src/openvpn/push.h +36 -1
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -56,6 +65,7 @@* @param option_types_found A pointer to a variable that will be filled with the types of options * found in the message. * @param buf A buffer containing the received message. +* @param msg_sender A boolean indicating if function is called by the message sender (server). * * @return * - `PUSH_MSG_UPDATE`: The message was processed successfully, and the updates were applied.
@@ -65,7 +75,8 @@*/ int process_incoming_push_update (struct context *c,unsigned int permission_mask, -unsigned int *option_types_found,struct buffer *buf); +unsigned int *option_types_found,struct buffer *buf, +bool msg_sender); int process_incoming_push_msg(struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask,
@@ -127,4 +138,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +264 -1
283 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -343,4 +343,5 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c
tests/unit_tests/openvpn/test_push_update_msg.c +278 -4
333 lines not on this page · raw message
[Openvpn-devel] [PATCH applied] Re: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Took us long enough... but after enough iterations, we're at a point now where this works well enough to include in 2.7_beta1 (and I can build an automated test rig on top of it).
I've stared long and hard at the code, we've discussed this a lot, and I've tested this with the client and server test beds (it somewhat affects the normal PUSH paths), and I purposely tested the new functionality, trying to push garbage to clients, "normal" options, and "new ifconfig IPs".
Pushing new IPv4 and IPv6 addresses works nicely now (in this case, only one client was connected, otherwise "push-update-broad" with the same IP address to all clients is a bit... silly)
Sep 3 18:35:22 gentoo tun-udp-p2mp[28688]: MANAGEMENT: CMD 'push-update-broad "ifconfig 10.204.2.166 10.204.2.5"' Sep 3 18:35:22 gentoo tun-udp-p2mp[28688]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,ifconfig 10.204.2.166 10.204.2.5' (status=1) Sep 3 18:35:22 gentoo tun-udp-p2mp[28688]: MULTI: Learn: 10.204.2.166 -> cron2-freebsd-tc-amd64/udp6:194.97.140.21:16758
As the code says in a big fat TODO, it's not unlearning the previous IP yet - so "status 2" has both old and new...
ROUTING_TABLE,10.204.2.6,cron2-freebsd-tc-amd64,udp6:194.97.140.21:16758,2025-09-03 18:35:22,1756917322 ROUTING_TABLE,10.204.2.166,cron2-freebsd-tc-amd64,udp6:194.97.140.21:16758,2025-09-03 18:36:08,1756917368
IPv6 works too:
Sep 3 18:41:26 gentoo tun-udp-p2mp[28688]: MANAGEMENT: CMD 'status 2' Sep 3 18:42:23 gentoo tun-udp-p2mp[28688]: MANAGEMENT: CMD 'push-update-broad "ifconfig-ipv6 fd00:abcd:204:2::99aa/64 fd00:abcd:204:2::1"' Sep 3 18:42:23 gentoo tun-udp-p2mp[28688]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,ifconfig-ipv6 fd00:abcd:204:2::99aa/64 fd00:abcd:204:2::1' (status=1) Sep 3 18:42:23 gentoo tun-udp-p2mp[28688]: MULTI: Learn: fd00:abcd:204:2::99aa -> cron2-freebsd-tc-amd64/udp6:194.97.140.21:24508
When I try to push garbage ("blurb", aka "new options in testing"), it will do what we agreed to do (namely, push to the client, even if the server doesn't understand the options).
The logging could be improved... "is not updatable, ignoring" *after* it was already pushed? And after that(!), an "Options error"... mmh.
Sep 3 18:39:18 gentoo tun-udp-p2mp[28688]: MANAGEMENT: CMD 'push-update-cid 41 ?blurb' Sep 3 18:39:18 gentoo tun-udp-p2mp[28688]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,?blurb' (status=1) Sep 3 18:39:18 gentoo tun-udp-p2mp[28688]: Pushed dispensable option is not updatable: '?blurb'. Ignoring. Sep 3 18:39:18 gentoo tun-udp-p2mp[28688]: Options error: Unrecognized option or missing or extra parameter(s) in [PUSH-OPTIONS]:1: blurb (2.7_alpha3)
Sep 3 18:40:15 gentoo tun-udp-p2mp[28688]: MANAGEMENT: CMD 'push-update-cid 41 blurb' Sep 3 18:40:15 gentoo tun-udp-p2mp[28688]: SENT CONTROL [cron2-freebsd-tc-amd64]: 'PUSH_UPDATE,blurb' (status=1) Sep 3 18:40:15 gentoo tun-udp-p2mp[28688]: Pushed option is not updatable: 'blurb'. Sep 3 18:40:15 gentoo tun-udp-p2mp[28688]: Failed to process push update message sent to client ID: 1
.. for the non-optional option (no "?"), it pushes just fine, no "Options error", but then a "Failed to process".
This is okayish to have the functionality in 2.7_beta1 so it can be tested more, but this needs more work. As does the fat TODO for unlearning IPs.
With all the changes to manage.c in the last days, the patch needed a bit of massaging to go in (multi.h was added -> conflict, things like that). I also fixed/ignored a few stray newline changes, and reformatted the big comment blob with too-long lines in push_util.c
Your patch has been applied to the master branch.
commit c598efc405b7a47ae66f7f78e455e2902b76ce88
Author: Marco Baffo Date: Wed Sep 3 18:48:20 2025 +0200
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Signed-off-by: Marco Baffo <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32807.html
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#26) to the change originally created by mrbff. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message to update some options. See doc/management-notes.txt for details.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32807.html
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/options.c
M src/openvpn/options_util.c
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
13 files changed, 741 insertions(+), 18 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/869/26
CMakeLists.txt +4 -3
@@ -874,9 +874,10 @@ target_sources(test_push_update_msg PRIVATE tests/unit_tests/openvpn/mock_msg.c tests/unit_tests/openvpn/mock_get_random.c - src/openvpn/push_util.c - src/openvpn/options_util.c - src/openvpn/otime.c + src/openvpn/push_util.c + src/openvpn/options_util.c + src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -2
87 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1u << 16)#define MF_EXTERNAL_KEY_DIGEST (1u << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -197,6 +196,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +7 -0
@@ -686,5 +686,12 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/options.c +0 -1
@@ -5488,7 +5488,6 @@ {continue ;/* Ignoring this option */ } -throw_signal_soft (SIGUSR1 ,"Offending option received from server" );return false;/* Cause push/pull error and stop push processing */ }
src/openvpn/options_util.c +2 -2
@@ -236,11 +236,11 @@ {if (*flags &PUSH_OPT_OPTIONAL ) { -msg (D_PUSH ,"Pushed option is not updatable: '%s'. Ignoring." , line); +msg (D_PUSH ,"Pushed dispensable option is not updatable: '%s'. Ignoring." , line); }else { -msg (M_WARN ,"Pushed option is not updatable: '%s'. Restarting." , line); +msg (M_WARN ,"Pushed option is not updatable: '%s'." , line);return false; } }
src/openvpn/push.c +5 -1
@@ -1073,6 +1073,10 @@break ; } } +else + { +throw_signal_soft (SIGUSR1 ,"Offending option received from server" ); + } }else if (ch =='\0' ) {
@@ -1100,7 +1104,7 @@ }else if (honor_received_options &&buf_string_compare_advance (&buf, push_update_cmd)) { -return process_incoming_push_update (c, permission_mask, option_types_found, &buf); +return process_incoming_push_update (c, permission_mask, option_types_found, &buf, false); }else {
src/openvpn/push.h +36 -1
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -56,6 +65,7 @@* @param option_types_found A pointer to a variable that will be filled with the types of options * found in the message. * @param buf A buffer containing the received message. +* @param msg_sender A boolean indicating if function is called by the message sender (server). * * @return * - `PUSH_MSG_UPDATE`: The message was processed successfully, and the updates were applied.
@@ -65,7 +75,8 @@*/ int process_incoming_push_update (struct context *c,unsigned int permission_mask, -unsigned int *option_types_found,struct buffer *buf); +unsigned int *option_types_found,struct buffer *buf, +bool msg_sender); int process_incoming_push_msg(struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask,
@@ -127,4 +138,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +268 -1
287 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -337,7 +337,8 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c socket_testdriver_CFLAGS = \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
tests/unit_tests/openvpn/test_push_update_msg.c +278 -4
333 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 26
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/869?usp=email )
Change subject: PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
......................................................................
PUSH_UPDATE message sender: enabling the server to send PUSH_UPDATE control messages
Using the management interface you can now target one or more clients (via broadcast or via cid) and send a PUSH_UPDATE control message to update some options. See doc/management-notes.txt for details.
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg32807.html
---
M CMakeLists.txt
M doc/management-notes.txt
M src/openvpn/manage.c
M src/openvpn/manage.h
M src/openvpn/multi.c
M src/openvpn/multi.h
M src/openvpn/options.c
M src/openvpn/options_util.c
M src/openvpn/push.c
M src/openvpn/push.h
M src/openvpn/push_util.c
M tests/unit_tests/openvpn/Makefile.am
M tests/unit_tests/openvpn/test_push_update_msg.c
13 files changed, 741 insertions(+), 18 deletions(-)
CMakeLists.txt +4 -3
@@ -874,9 +874,10 @@ target_sources(test_push_update_msg PRIVATE tests/unit_tests/openvpn/mock_msg.c tests/unit_tests/openvpn/mock_get_random.c - src/openvpn/push_util.c - src/openvpn/options_util.c - src/openvpn/otime.c + src/openvpn/push_util.c + src/openvpn/options_util.c + src/openvpn/otime.c + src/openvpn/list.c ) if (TARGET test_argv)
doc/management-notes.txt +29 -0
@@ -1028,6 +1028,35 @@ stored outside of the filesystem (e.g. in Mac OS X Keychain) with OpenVPN via the management interface. +COMMAND -- push-update-broad (OpenVPN 2.7 or higher) +---------------------------------------------------- +Send a message to every connected client to update options at runtime. +The updatable options are: "block-ipv6", "block-outside-dns", "dhcp-option", +"dns", "ifconfig", "ifconfig-ipv6", "redirect-gateway", "redirect-private", +"route", "route-gateway", "route-ipv6", "route-metric", "topology", +"tun-mtu", "keepalive". When a valid option is pushed, the receiving client will +delete every previous value and set new value, so the update of the option will +not be incremental even when theoretically possible (ex. with "redirect-gateway"). +The '-' symbol in front of an option means the option should be removed. +When an option is used with '-', it cannot take any parameter. +The '?' symbol in front of an option means the option's update is optional +so if the client do not support it, that option will just be ignored without +making fail the entire command. The '-' and '?' symbols can be used together. + +Option Format Ex. + `-?option`, `-option`, `?option parameters` are valid formats, + `?-option` is not a valid format. + +Example + push-update-broad "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + +COMMAND -- push-update-cid (OpenVPN 2.7 or higher) +---------------------------------------------------- +Same as push-update-broad but you must target a single client using client id. + +Example + push-update-cid 42 "route 10.10.10.1 255.255.255.255, -dns, ?tun-mtu 1400" + OUTPUT FORMAT -------------
src/openvpn/manage.c +61 -2
87 lines not on this page · raw message
src/openvpn/manage.h +2 -1
@@ -43,7 +43,6 @@#define MF_EXTERNAL_KEY_PSSPAD (1u << 16)#define MF_EXTERNAL_KEY_DIGEST (1u << 17) -#ifdef ENABLE_MANAGEMENT #include "misc.h"
@@ -197,6 +196,8 @@#endif unsigned int (*remote_entry_count)(void *arg);bool (*remote_entry_get)(void *arg,unsigned int index,char **remote); +bool (*push_update_broadcast)(void *arg,const char *options); +bool (*push_update_by_cid)(void *arg,unsigned long cid,const char *options); };/*
src/openvpn/multi.c +47 -1
63 lines not on this page · raw message
src/openvpn/multi.h +7 -0
@@ -686,5 +686,12 @@*/ void multi_assign_peer_id (struct multi_context *m,struct multi_instance *mi); +#ifdef ENABLE_MANAGEMENT +struct multi_instance * +lookup_by_cid (struct multi_context *m,const unsigned long cid); +#endif + +void +update_vhash (struct multi_context *m,struct multi_instance *mi,const char *old_ip,const char *old_ipv6);#endif /* MULTI_H */
src/openvpn/options.c +0 -1
@@ -5488,7 +5488,6 @@ {continue ;/* Ignoring this option */ } -throw_signal_soft (SIGUSR1 ,"Offending option received from server" );return false;/* Cause push/pull error and stop push processing */ }
src/openvpn/options_util.c +2 -2
@@ -236,11 +236,11 @@ {if (*flags &PUSH_OPT_OPTIONAL ) { -msg (D_PUSH ,"Pushed option is not updatable: '%s'. Ignoring." , line); +msg (D_PUSH ,"Pushed dispensable option is not updatable: '%s'. Ignoring." , line); }else { -msg (M_WARN ,"Pushed option is not updatable: '%s'. Restarting." , line); +msg (M_WARN ,"Pushed option is not updatable: '%s'." , line);return false; } }
src/openvpn/push.c +5 -1
@@ -1073,6 +1073,10 @@break ; } } +else + { +throw_signal_soft (SIGUSR1 ,"Offending option received from server" ); + } }else if (ch =='\0' ) {
@@ -1100,7 +1104,7 @@ }else if (honor_received_options &&buf_string_compare_advance (&buf, push_update_cmd)) { -return process_incoming_push_update (c, permission_mask, option_types_found, &buf); +return process_incoming_push_update (c, permission_mask, option_types_found, &buf, false); }else {
src/openvpn/push.h +36 -1
@@ -41,6 +41,15 @@#define PUSH_OPT_TO_REMOVE (1 << 0)#define PUSH_OPT_OPTIONAL (1 << 1) +#ifdef ENABLE_MANAGEMENT +/* Push-update message sender modes */ +typedef enum +{ +UPT_BROADCAST =0 , +UPT_BY_CID =1 +}push_update_type ; +#endif +int process_incoming_push_request (struct context *c);/**
@@ -56,6 +65,7 @@* @param option_types_found A pointer to a variable that will be filled with the types of options * found in the message. * @param buf A buffer containing the received message. +* @param msg_sender A boolean indicating if function is called by the message sender (server). * * @return * - `PUSH_MSG_UPDATE`: The message was processed successfully, and the updates were applied.
@@ -65,7 +75,8 @@*/ int process_incoming_push_update (struct context *c,unsigned int permission_mask, -unsigned int *option_types_found,struct buffer *buf); +unsigned int *option_types_found,struct buffer *buf, +bool msg_sender); int process_incoming_push_msg(struct context *c, const struct buffer *buffer, bool honor_received_options, unsigned int permission_mask,
@@ -127,4 +138,28 @@*/ void receive_auth_pending (struct context *c,const struct buffer *buffer); +#ifdef ENABLE_MANAGEMENT +/** +* @brief A function to send a PUSH_UPDATE control message from server to client(s). +* +* @param m the multi_context, contains all the clients connected to this server. +* @param target the target to which to send the message. It should be: +* `NULL` if `type == UPT_BROADCAST`, +* a `mroute_addr *` if `type == UPT_BY_ADDR`, +* a `char *` if `type == UPT_BY_CN`, +* an `unsigned long *` if `type == UPT_BY_CID`. +* @param msg a string containing the options to send. +* @param type the way to address the message (broadcast, by cid, by cn, by address). +* @param push_bundle_size the maximum size of a bundle of pushed option. Just use PUSH_BUNDLE_SIZE macro. +* @return the number of clients to which the message was sent. +*/ +int +send_push_update (struct multi_context *m,const void *target,const char *msg,const push_update_type type,const int push_bundle_size); + +bool management_callback_send_push_update_broadcast (void *arg,const char *options); + +bool management_callback_send_push_update_by_cid (void *arg,unsigned long cid,const char *options); + +#endif /* ifdef ENABLE_MANAGEMENT*/ +#endif /* ifndef PUSH_H */
src/openvpn/push_util.c +268 -1
287 lines not on this page · raw message
tests/unit_tests/openvpn/Makefile.am +2 -1
@@ -337,7 +337,8 @@ $(top_srcdir)/src/openvpn/platform.c \ $(top_srcdir)/src/openvpn/push_util.c \ $(top_srcdir)/src/openvpn/options_util.c \ - $(top_srcdir)/src/openvpn/otime.c + $(top_srcdir)/src/openvpn/otime.c \ + $(top_srcdir)/src/openvpn/list.c socket_testdriver_CFLAGS = \ -I$(top_srcdir)/include -I$(top_srcdir)/src/compat -I$(top_srcdir)/src/openvpn \
tests/unit_tests/openvpn/test_push_update_msg.c +278 -4
333 lines not on this page · raw message
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/869?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ie82bcc7a8e583de9156b185d71d1a323ed8df3fc
Gerrit-Change-Number: 869
Gerrit-PatchSet: 26
Gerrit-Owner: mrbff <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-Reviewer: stipa <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged